package part1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Java5Ex2
 *   Example of an enhanced for loop
 * @author tony
 *
 */

public class Java5Ex2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		List list = new ArrayList();
		list.add("Hello");
		list.add( 1 );
		list.add( 100 );
		list.add( "Goodbye" );
		/*
		 * Iterator for loop
		 */
		for (Iterator i = list.iterator(); i.hasNext(); )
			System.out.println( i.next() );

		/*
		 * Enhanced for loop
		 */
		for (Object o : list )
			System.out.println( o );

	}

}
